﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Drawing;
using Grid.Extensions;
using System.Windows.Forms;
using System.Xml.Serialization;

namespace LUC.Domains
{
	public class Notification
	{
		public int id_feed { get; set; }
		
		public int id_notification { get; set; }
		public int id_global { get; set; }
		
		[DisplayName("Сообщение")]
		public string text { get; set; }

		[Browsable(false)]
		public SerializableFont font { get; set; }

		[DisplayName("Шрифт")]
		[XmlIgnore]
		public Font font_disp
		{ 
			get { return font.ToFont(); }
			set { font = new SerializableFont(value); }
		}

		[Browsable(false)]
		public int color { get; set; }

		[DisplayName("Цвет")]
		[XmlIgnore]
		public Color color_disp
		{
			get { return ColorTranslator.FromWin32(color); }
			set { color = ColorTranslator.ToWin32(value); }
		}

		[DisplayName("Время")]
		[DateTimeFormat(Format = DateTimePickerFormat.Custom, CustomFormat = "dd.MM.yyyy HH:mm")]
		public DateTime deadline { get; set; }

		[DisplayName("Период по дням ")]
		[NumericFormat(MinValue = -100, MaxValue = 100)]
		public int increment_days { get; set; }

		[DisplayName("Период по HH:mm")]
		[DateTimeFormat(Format=DateTimePickerFormat.Time)]
		public DateTime increment_hhmmss { get; set; }

		[DisplayName("Оповещать")]
		public bool ringed { get; set; }

		[DisplayName("Удалять")]
		public bool delete_happen { get; set; }

		
		public Notification()
		{

		}

		public Notification(Notification n_notif)
		{
			text = n_notif.text;
			id_feed = n_notif.id_feed;
			font = n_notif.font;
			color = n_notif.color;
			deadline = n_notif.deadline;
			increment_days = n_notif.increment_days;
			increment_hhmmss = n_notif.increment_hhmmss;
			ringed = n_notif.ringed;
			delete_happen = n_notif.delete_happen;
		}
	}
}
